{include file="public/layout" /}
<body class="bodystyle" style="cursor: default; -moz-user-select: inherit;">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
{include file="system/left" /}
<div class="page min-hg-c-10" style="min-width:auto;margin-left:100px;">
    {include file="users_score/bar" /}
    <div class="flexigrid">
        <form class="form-horizontal" id="post_form" action="{:url('UsersScore/conf')}" method="post">
            <div class="hDiv htitx">
                <div class="hDivBox">
                    <table cellspacing="0" cellpadding="0" style="width: 100%">
                        <thead>
                            <tr>
                                <th class="w10"><div class="tc"></div></th>
                                <th class="w10"><div class="tc">积分设置</div></th>
                                <th class=""><div class=""></div></th>
                            </tr>
                        </thead>
                    </table>
                </div>
            </div>

            <div class="ncap-form-default">
                <dl class="row">
                    <dt class="tit" style="width: 120px;"><label for="score_name"><em>*</em>积分名称</label></dt>
                    <dd class="opt">
                        <div class="inpit-word">
                            <input type="text" id="score_name" name="score_name" value="{$score.score_name|default='积分'}" placeholder="前台积分文案" autocomplete="off" oninput="wordLeg(this);" maxlength="4" onpropertychange="if (value.length > 4) value=value.substr(0, 4);">
                            <div class="word"><span class="text_count">0</span>/<span class="num_count" id="numCount">4</span></div>
                        </div>
                        <p class="notic">注：修改积分名称后，在买家端的所有页面里，看到的都是自定义的名称
                        例：商家使用自定义的积分名称来做品牌运营。如京东把积分称为“京豆”，淘宝把积分称为“淘金币”</p>
                    </dd>
                </dl>

                <dl class="row">
                    <dt class="tit" style="width: 120px;"><label>消费获得积分</label></dt>
                    <dd class="opt">
                        <label class="curpoin">
                            <input name="score_consume_status" value="1" type="radio" {if condition="!empty($score.score_consume_status)"} checked="checked" {/if} onclick="changeStatus('control_consume_status', 1);">开启
                        </label>
                        &nbsp;
                        <label class="curpoin">
                            <input name="score_consume_status" value="0" type="radio" {if condition="empty($score.score_consume_status)"} checked="checked" {/if} onclick="changeStatus('control_consume_status', 0);">关闭
                        </label>
                        <p class="notic">用户订单完成且不可维权后，才能获得积分</p>
                    </dd>
                </dl>

                <dl class="row {empty name='$score.score_consume_status'}none{/empty}" id="control_consume_status">
                    <input type="hidden" id="score_consume_quota" name="score_consume_quota" value="{$score.score_consume_quota|default=10}">
                    <dt class="tit" style="width: 120px;"><label for="score_consume_money">消费￥{$score.score_consume_quota|default='10.00'}获得</label></dt>
                    <dd class="opt">
                        <input type="text" id="score_consume_money" name="score_consume_money" value="{$score.score_consume_money|default=1}" class="w80" onpaste='this.value=this.value.replace(/^\D*([0-9]\d*)?.*$/, "$1");' onkeyup='this.value=this.value.replace(/^\D*([0-9]\d*)?.*$/, "$1");'>&nbsp;积分
                    </dd>
                </dl>
            </div>
            <div class="ncap-form-default">
                <div class="bot2 e-l-110">
                    <a href="JavaScript:void(0);" onclick="check_submit();" class="ncap-btn-big ncap-btn-green w60">保存</a>
                </div>
            </div>
        </form>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function() {
        wordLeg($('#score_name'));  
    });

    // 字数限制 积分名称
    function wordLeg(obj) {
        var currleg = $(obj).val().length;
        var length = $(obj).attr('maxlength');
        if (currleg > length) {
           showErrorMsg('字数请在' + length + '字以内');
        } else {
           $('.text_count').text(currleg);
        }
    }

    function changeStatus(id, val) {
        if (1 == val) {
            $("#"+id).show();
        } else {
            $("#"+id).hide();
        }
    }

    function check_submit() {
        if($('input[name=score_name]').val() == ''){
            showErrorMsg('积分名称不能为空！');
            $('input[name=score_name]').focus();
            return false;
        }
        layer_loading('正在处理');
        $('#post_form').submit();
    }
</script>
{include file="public/footer" /}